<template>
  <div>
    <img
      :src="img"
      alt=""
      @click="load"
    >
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { onMounted } from '@vue/runtime-core'
import http from '../http/req'
import url from '../config/url'
let img = ref('')
let key = ref('')
onMounted(() => {
  load()
})
const load = () => {
  http.get(url.Captcha).then((res) => {
    if (res.status === 200) {
      img.value = res.data.img
      key.value = res.data.key
    }
  })
}
defineExpose({
  key,
  load
})
</script>

<style lang="scss" scoped>
div {
  display: flex;
  align-items: center;
  cursor: pointer;
}
</style>